@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uni.UNIF42C880
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import io.dcloud.uniapp.extapi.chooseImage as uni_chooseImage
import io.dcloud.uniapp.extapi.hideLoading as uni_hideLoading
import io.dcloud.uniapp.extapi.navigateBack as uni_navigateBack
import io.dcloud.uniapp.extapi.navigateTo as uni_navigateTo
import io.dcloud.uniapp.extapi.showLoading as uni_showLoading
import io.dcloud.uniapp.extapi.showToast as uni_showToast
open class GenPagesCameraCamera : BasePage {
    constructor(__ins: ComponentInternalInstance, __renderer: String?) : super(__ins, __renderer) {
        onLoad(fun(_: OnLoadOptions) {
            this.takePhoto()
        }
        , __ins)
        onPageShow(fun() {}, __ins)
    }
    @Suppress("UNUSED_PARAMETER", "UNUSED_VARIABLE")
    override fun `$render`(): Any? {
        val _ctx = this
        val _cache = this.`$`.renderCache
        return createElementVNode("view", utsMapOf("class" to "camera-container"), utsArrayOf(
            createElementVNode("view", utsMapOf("class" to "custom-nav"), utsArrayOf(
                createElementVNode("view", utsMapOf("class" to "nav-left", "onClick" to _ctx.goBack), utsArrayOf(
                    createElementVNode("text", utsMapOf("class" to "nav-icon"), "←")
                ), 8, utsArrayOf(
                    "onClick"
                )),
                createElementVNode("view", utsMapOf("class" to "nav-title"), utsArrayOf(
                    createElementVNode("text", null, "拍照")
                )),
                createElementVNode("view", utsMapOf("class" to "nav-right"))
            )),
            createElementVNode("view", utsMapOf("class" to "camera-preview"), utsArrayOf(
                createElementVNode("image", utsMapOf("class" to "preview-image", "src" to "/static/camera-preview.png", "mode" to "aspectFill")),
                createElementVNode("view", utsMapOf("class" to "camera-controls"), utsArrayOf(
                    createElementVNode("view", utsMapOf("class" to "control-item"), utsArrayOf(
                        createElementVNode("text", utsMapOf("class" to "control-icon"), "🔄")
                    )),
                    createElementVNode("view", utsMapOf("class" to "capture-btn", "onClick" to _ctx.takePhoto), utsArrayOf(
                        createElementVNode("view", utsMapOf("class" to "capture-btn-inner"))
                    ), 8, utsArrayOf(
                        "onClick"
                    )),
                    createElementVNode("view", utsMapOf("class" to "control-item"), utsArrayOf(
                        createElementVNode("text", utsMapOf("class" to "control-icon"), "⚡")
                    ))
                ))
            ))
        ))
    }
    open var devicePosition: String by `$data`
    open var flashMode: String by `$data`
    @Suppress("USELESS_CAST")
    override fun data(): Map<String, Any?> {
        return utsMapOf("devicePosition" to "back", "flashMode" to "auto")
    }
    open var goBack = ::gen_goBack_fn
    open fun gen_goBack_fn() {
        uni_navigateBack(null)
    }
    open var takePhoto = ::gen_takePhoto_fn
    open fun gen_takePhoto_fn() {
        uni_showLoading(ShowLoadingOptions(title = "打开相机..."))
        uni_chooseImage(ChooseImageOptions(count = 1, sourceType = utsArrayOf(
            "camera"
        ), success = fun(res){
            uni_hideLoading()
            uni_navigateTo(NavigateToOptions(url = "/pages/edit/edit?image="))
        }
        , fail = fun(err){
            uni_hideLoading()
            uni_showToast(ShowToastOptions(title = "拍照失败", icon = "none"))
            console.error("Camera error:", err)
        }
        ))
    }
    companion object {
        val styles: Map<String, Map<String, Map<String, Any>>> by lazy {
            normalizeCssStyles(utsArrayOf(
                styles0
            ), utsArrayOf(
                GenApp.styles
            ))
        }
        val styles0: Map<String, Map<String, Map<String, Any>>>
            get() {
                return utsMapOf("camera-container" to padStyleMapOf(utsMapOf("position" to "relative", "width" to "100%", "height" to "100%", "backgroundColor" to "#000000")), "custom-nav" to padStyleMapOf(utsMapOf("position" to "absolute", "top" to 0, "left" to 0, "right" to 0, "height" to 90, "paddingTop" to 40, "display" to "flex", "flexDirection" to "row", "alignItems" to "center", "justifyContent" to "space-between", "paddingLeft" to 15, "paddingRight" to 15, "backgroundColor" to "rgba(0,0,0,0.3)", "zIndex" to 100)), "nav-left" to padStyleMapOf(utsMapOf("width" to 40, "height" to 40, "display" to "flex", "alignItems" to "center", "justifyContent" to "center")), "nav-right" to padStyleMapOf(utsMapOf("width" to 40, "height" to 40, "display" to "flex", "alignItems" to "center", "justifyContent" to "center")), "nav-icon" to padStyleMapOf(utsMapOf("color" to "#ffffff", "fontSize" to 24)), "nav-title" to padStyleMapOf(utsMapOf("flex" to 1, "textAlign" to "center")), "camera-preview" to padStyleMapOf(utsMapOf("width" to "100%", "height" to "100%", "position" to "relative", "backgroundColor" to "#000000")), "preview-image" to padStyleMapOf(utsMapOf("width" to "100%", "height" to "100%", "objectFit" to "cover")), "camera-controls" to padStyleMapOf(utsMapOf("position" to "absolute", "bottom" to 50, "left" to 0, "right" to 0, "display" to "flex", "flexDirection" to "row", "alignItems" to "center", "justifyContent" to "space-around", "paddingTop" to 0, "paddingRight" to 50, "paddingBottom" to 0, "paddingLeft" to 50)), "control-item" to padStyleMapOf(utsMapOf("width" to 50, "height" to 50, "borderTopLeftRadius" to 25, "borderTopRightRadius" to 25, "borderBottomRightRadius" to 25, "borderBottomLeftRadius" to 25, "backgroundColor" to "rgba(255,255,255,0.3)", "display" to "flex", "alignItems" to "center", "justifyContent" to "center")), "control-icon" to padStyleMapOf(utsMapOf("fontSize" to 24, "color" to "#ffffff")), "capture-btn" to padStyleMapOf(utsMapOf("width" to 70, "height" to 70, "borderTopLeftRadius" to 35, "borderTopRightRadius" to 35, "borderBottomRightRadius" to 35, "borderBottomLeftRadius" to 35, "backgroundColor" to "rgba(255,255,255,0.3)", "display" to "flex", "alignItems" to "center", "justifyContent" to "center")), "capture-btn-inner" to padStyleMapOf(utsMapOf("width" to 60, "height" to 60, "borderTopLeftRadius" to 30, "borderTopRightRadius" to 30, "borderBottomRightRadius" to 30, "borderBottomLeftRadius" to 30, "backgroundColor" to "#ffffff")))
            }
        var inheritAttrs = true
        var inject: Map<String, Map<String, Any?>> = utsMapOf()
        var emits: Map<String, Any?> = utsMapOf()
        var props = normalizePropsOptions(utsMapOf())
        var propsNeedCastKeys: UTSArray<String> = utsArrayOf()
        var components: Map<String, CreateVueComponent> = utsMapOf()
    }
}
